<?php


namespace Admin\Controller;
use Think\Controller;
class LiuyanController extends CommenController {
    public function index(){
           $m = M('liuyan');
           $count = $m->count();
           $page = new \Think\Page($count,8);
           $show = $page->show();
           $list = $m->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
           $this->assign("list",$list);
           $this->assign("page",$show);
    	   $this->display();
    }

    public function delete(){
    	$id = $_GET['id'];
    	$m = M('liuyan');
    	$result = $m->where("id = {$id}")->delete();
    	if($result>0){
    		$this->success("删除成功!");
    	}else{
    		$this->error("删除失败!");
    	}
    }

}